const http = require('http');
const {URL} = require('url');

const app = http.createServer((req,res) => {
    console.log('req:',req);
    // console.log('res:',res);

    // const url = new URL(req.url);
    // console.log(url);

    if(req.url === '/fontend') {

        res.end('fonted');
    } else if (req.url === '/backend') {

        res.end('backend');

    }
    
    res.end('hello world');
});


app.listen(1314,() => {
    console.log('服务启动了');
})